<template>
  <div class="home">
    <!-- 轮播图部分 -->
    <div class="banner">
      <el-carousel height="500px">
        <el-carousel-item v-for="item in bannerItems" :key="item.id">
          <img :src="item.image" :alt="item.title" class="banner-image">
          <div class="banner-content">
            <h2>{{ item.title }}</h2>
            <p>{{ item.description }}</p>
            <router-link :to="item.link" class="banner-button">了解更多</router-link>
          </div>
        </el-carousel-item>
      </el-carousel>
    </div>

    <!-- 服务分类部分 -->
    <section class="services-section">
      <h2 class="section-title">我们的服务</h2>
      <div class="services-grid">
        <div v-for="service in services" :key="service.id" class="service-card">
          <img :src="service.image" :alt="service.title" class="service-image">
          <h3>{{ service.title }}</h3>
          <p>{{ service.description }}</p>
          <router-link :to="service.link" class="service-link">查看详情</router-link>
        </div>
      </div>
    </section>

    <!-- 特色优势部分 -->
    <section class="features-section">
      <h2 class="section-title">为什么选择我们</h2>
      <div class="features-grid">
        <div v-for="feature in features" :key="feature.id" class="feature-card">
          <el-icon :size="40" class="feature-icon">
            <component :is="feature.icon" />
          </el-icon>
          <h3>{{ feature.title }}</h3>
          <p>{{ feature.description }}</p>
        </div>
      </div>
    </section>
  </div>
</template>

<script>
export default {
  name: 'HomePage',
  data() {
    return {
      bannerItems: [
        {
          id: 1,
          title: '专业宠物美容服务',
          description: '让您的爱宠焕发新光彩',
          image: require('@/assets/banner1.png'),
          link: '/services'
        },
        {
          id: 2,
          title: '宠物寄养服务',
          description: '为您的爱宠提供温馨的家',
          image: require('@/assets/banner2.png'),
          link: '/services'
        },
        {
          id: 3,
          title: '宠物训练课程',
          description: '培养听话的好伙伴',
          image: require('@/assets/banner3.png'),
          link: '/services'
        },
        {
          id: 4,
          title: '宠物医疗健康',
          description: '专业医疗团队守护宠物健康',
          image: require('@/assets/banner4.png'),
          link: '/services'
        }
      ],
      services: [
        {
          id: 1,
          title: '宠物美容',
          description: '专业美容师为您提供全方位的美容服务',
          image: require('@/assets/service-beauty.png'),
          link: '/services'
        },
        {
          id: 2,
          title: '宠物寄养',
          description: '温馨舒适的寄养环境，让您放心出行',
          image: require('@/assets/service-boarding.png'),
          link: '/services'
        },
        {
          id: 3,
          title: '宠物训练',
          description: '专业训练师帮助培养良好的行为习惯',
          image: require('@/assets/service-training.png'),
          link: '/services'
        },
        {
          id: 4,
          title: '宠物医疗',
          description: '专业的医疗团队为您的爱宠保驾护航',
          image: require('@/assets/service-medical.png'),
          link: '/services'
        }
      ],
      features: [
        {
          id: 1,
          icon: 'Medal',
          title: '专业团队',
          description: '拥有多年经验的宠物服务专家'
        },
        {
          id: 2,
          icon: 'Star',
          title: '优质服务',
          description: '提供全方位的宠物服务解决方案'
        },
        {
          id: 3,
          icon: 'Timer',
          title: '便捷预约',
          description: '在线预约，省时省力'
        },
        {
          id: 4,
          icon: 'Service',
          title: '售后保障',
          description: '完善的售后服务体系'
        }
      ]
    }
  }
}
</script>

<style scoped>
.home {
  padding-top: 64px;
}

.banner {
  margin-bottom: 40px;
}

.banner-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-content {
  position: absolute;
  bottom: 20%;
  left: 10%;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.banner-button {
  display: inline-block;
  padding: 10px 20px;
  background-color: #409EFF;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  margin-top: 20px;
}

.section-title {
  text-align: center;
  margin-bottom: 40px;
  font-size: 32px;
  color: #333;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  padding: 0 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.service-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
}

.service-card:hover {
  transform: translateY(-5px);
}

.service-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.service-card h3 {
  padding: 20px 20px 10px;
  margin: 0;
}

.service-card p {
  padding: 0 20px 20px;
  color: #666;
  margin: 0;
}

.service-link {
  display: block;
  padding: 10px 20px;
  background-color: #f5f7fa;
  color: #409EFF;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.3s;
}

.service-link:hover {
  background-color: #ecf5ff;
}

.features-section {
  background-color: #f5f7fa;
  padding: 60px 0;
  margin: 40px 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  padding: 0 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  text-align: center;
  padding: 30px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.feature-icon {
  color: #409EFF;
  margin-bottom: 20px;
}

.feature-card h3 {
  margin: 0 0 10px;
  color: #333;
}

.feature-card p {
  color: #666;
  margin: 0;
}
</style> 